/**
 * Created by on 2017/6/15.
 */
import React from "react";
import Util from "../../../../../util/Util";
import { Table, Icon, message, Tooltip } from 'antd';
import AddImgModal from "../../AddImgModal";
import "./css/orderDetailStyle.css"
/*信息列表*/
export default class OrderDetailIndexTable extends React.Component{
    constructor(props){
        super(props);
        this.state={

        };
        this.orderType = ''
        this.serviceType = sessionStorage.getItem('serviceType');
        this.enterpriseId = sessionStorage.getItem('enterpriseId');
        //订单类型 1:  gms 成衣, 2： raw 辅料,3： cloth 布料, 4： print 印染, 5： yarn 纱线
    }

    componentWillMount() {
        this.orderType = this.props.orderType || '';
    }
    sumMoney() {   //合计  大小写
        let sumMoney = 0
        this.props.order.orderGoodss ? this.props.order.orderGoodss.map((v, i) => {
            if (v.quantity && v.price) {
                // sumMoney += (v.quantity*v.price)
                sumMoney += Number(v.tableOrderMoney)
            }
            return sumMoney
        }) : null
        return parseFloat(sumMoney).toFixed(2);
    }

    sumTotal() {
        let sumTotal = 0
        this.props.order.orderGoodss ? this.props.order.orderGoodss.map((v, i) => {
            if (v.quantity) {
                sumTotal += parseFloat(v.quantity)
            }
            return sumTotal
        }) : null
        return sumTotal.toFixed(3)
    }

    showImg(url){
       this.refs.addimg.setState({
          url:url,
          visible:true
      });
    }

    render() {
        //column顺序依次是 成衣 辅料  面料 印染 纱线
        const columnsArr = [
            [
                {
                    title: '',
                    dataIndex: '',
                    key: '',
                    width: '60',
                    render: ((text, record, index)=>{
                        if(index == this.props.order.orderGoodss.length-2) {

                        } else if(index == this.props.order.orderGoodss.length-1) {

                        } else {
                            return ++index
                        }

                    })
                },
                {
                    title: 'PO号',
                    dataIndex: 'poNumber',
                    key: 'poNumber',
                    width: 200,
                    render: ((text, record, index)=>{
                        if(index == this.props.order.orderGoodss.length-2) {
                            return '合计'
                        } else if(index == this.props.order.orderGoodss.length-1) {
                            return '合计(大写)'
                        } else {
                            return record.poNumber
                        }
                    })
                },
                {
                    title: '款号',
                    dataIndex: 'styleNo',
                    key: 'styleNo',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.children = <span style={{display: 'block',textAlign:'left',paddingLeft:'20px'}}>{Util.numtoChinese(this.sumMoney())}</span>
                            obj.props.colSpan  = 13;
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.colSpan  = 9;
                            return obj;
                        } else {
                            return record.styleNo
                        }
                    })
                },
                {
                    title: '图片',
                    dataIndex: 'url',
                    key: 'url',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan  = 0;
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            return this.sumTotal()
                        } else {

                            return (record.url && <img src={record.url} style={{width:140,height:33}} alt="" onClick={this.showImg.bind(this, record.url)}/>)
                        }
                    })
                },
                {
                    title: '品名',
                    dataIndex: 'productName',
                    key: 'productName',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {

                        } else {
                            return record.productName
                        }
                    })
                },
                {
                    title: '描述/规格',
                    dataIndex: 'description',
                    key: 'description',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            return this.sumMoney()
                        } else {
                            return record.description
                        }
                    })
                },
                {
                    title: '颜色',
                    dataIndex: 'colour',
                    key: 'colour',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.rowSpan = 0
                            return obj
                        } else {
                            return record.colour
                        }
                    })
                },
                {
                    title: '尺码',
                    dataIndex: 'size',
                    key: 'size',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.rowSpan = 0
                            return obj
                        } else {
                            return record.size
                        }
                    })
                },
                {
                    title: '数量配比',
                    dataIndex: 'datamatching',
                    key: 'datamatching',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.rowSpan = 0
                            return obj
                        } else {
                            return record.datamatching
                        }
                    })
                },
                {
                    title: '船期',
                    dataIndex: 'sailingDate',
                    key: 'sailingDate',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.rowSpan = 0
                            return obj
                        } else {
                            return record.sailingDate
                        }
                    })
                },
                {
                    title: '单位',
                    dataIndex: 'prickle',
                    key: 'prickle',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.rowSpan = 0
                            return obj
                        } else {
                            return record.prickle
                        }
                    })
                },
                {
                    title: '数量',
                    dataIndex: 'quantity',
                    key: 'quantity',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        }  else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.rowSpan = 0
                            return obj
                        } else {
                            return Util.doubleFormat(parseFloat(record.quantity).toFixed(3))
                        }
                    })
                },
                {
                    title: '单价',
                    dataIndex: 'price',
                    key: 'price',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.rowSpan = 0
                            return obj
                        } else {
                            return Util.doubleFormat(record.price)
                        }
                    })
                },
                {
                    title: '金额',
                    dataIndex: 'tableOrderMoney',
                    key: 'tableOrderMoney',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.rowSpan = 0
                            return obj
                        } else {
                            return record.tableOrderMoney
                        }
                    })
                },
                {
                    title: '备注',
                    dataIndex: 'desp',
                    key: 'desp',
                    width: 200,
                    render:((text,record,index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {

                        } else {
                            return text && text.length > 5 ? (
                                <Tooltip
                                    placement="topLeft"
                                    title={text}
                                    getPopupContainer={() => document.getElementsByClassName("columnsGoodsDetail")[0]}
                                >
                                    <span className='order_detail_remark'>{text}</span>
                                </Tooltip>
                            ) : <span>{text}</span>
                        }

                    })
                }
            ],
            [
                {
                    title: '',
                    dataIndex: '',
                    key: '',
                    width: '60',
                    render: ((text, record, index)=>{
                        if(index == this.props.order.orderGoodss.length-2) {

                        } else if(index == this.props.order.orderGoodss.length-1) {

                        } else {
                            return ++index
                        }

                    })
                },
                {
                    title: '款号',
                    dataIndex: 'styleNo',
                    key: 'styleNo',
                    width: 200,
                    render: ((text, record, index)=>{
                        if(index == this.props.order.orderGoodss.length-2) {
                            return '合计'
                        } else if(index == this.props.order.orderGoodss.length-1) {
                            return '合计(大写)'
                        } else {
                            return record.styleNo
                        }
                    })
                },
                {
                    title: '品名',
                    dataIndex: 'productName',
                    key: 'productName',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.children = <span style={{display: 'block',textAlign:'left',paddingLeft:'20px'}}>{Util.numtoChinese(this.sumMoney())}</span>
                            obj.props.colSpan  = 8;
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.colSpan  = 4;
                            return obj;
                        } else {
                            return record.productName
                        }
                    })
                },
                {
                    title: '描述/规格',
                    dataIndex: 'description',
                    key: 'description',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan  = 0;
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.colSpan  = 0;
                            return obj;
                        } else {
                            return record.description
                        }
                    })
                },
                {
                    title: '颜色',
                    dataIndex: 'colour',
                    key: 'colour',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan  = 0;
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.colSpan  = 0;
                            return obj;
                        } else {
                            return record.colour
                        }
                    })
                },
                {
                    title: '单位',
                    dataIndex: 'prickle',
                    key: 'prickle',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.rowSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            return this.sumTotal()
                        } else {
                            return record.prickle
                        }
                    })
                },

                {
                    title: '数量',
                    dataIndex: 'quantity',
                    key: 'quantity',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-2) {
                            // obj.props.rowSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        }  else {
                            return parseFloat(record.quantity).toFixed(3)
                        }
                    })
                },
                {
                    title: '单价',
                    dataIndex: 'price',
                    key: 'price',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            return this.sumMoney()
                        } else {
                            return record.price
                        }
                    })
                },
                {
                    title: '金额',
                    dataIndex: 'tableOrderMoney',
                    key: 'tableOrderMoney',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.colSpan = 0
                            return obj
                        } else {
                            return record.tableOrderMoney
                        }
                    })
                },
                {
                    title: '备注',
                    dataIndex: 'desp',
                    key: 'desp',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.rowSpan = 0
                            return obj
                        } else if (index == this.props.order.orderGoodss.length-2){

                        } else {
                            return text && text.length > 5 ? (
                                <Tooltip
                                    placement="topLeft"
                                    title={text}
                                    getPopupContainer={() => document.getElementsByClassName("columnsGoodsDetail")[0]}
                                >
                                    <span className='order_detail_remark'>{text}</span>
                                </Tooltip>
                            ) : <span>{text}</span>
                        }
                    })
                }
            ],
            [
                {
                    title: '',
                    dataIndex: '',
                    key: '',
                    width: '60',
                    render: ((text, record, index)=>{
                        if(index == this.props.order.orderGoodss.length-2) {

                        } else if(index == this.props.order.orderGoodss.length-1) {

                        } else {
                            return ++index
                        }

                    })
                },
                {
                    title: '款号',
                    dataIndex: 'styleNo',
                    key: 'styleNo',
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-2) {
                            return '合计'
                        } else if(index == this.props.order.orderGoodss.length-1) {
                            return '合计(大写)'
                        } else {
                            return record.styleNo
                        }
                    })
                },
                {
                    title: '品名',
                    dataIndex: 'productName',
                    key: 'productName',
                    width: 200,
                    render: ((text, record, index) => {
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.children = <span style={{display: 'block',textAlign:'left',paddingLeft:'20px'}}>{Util.numtoChinese(this.sumMoney())}</span>
                            obj.props.colSpan  = 10;
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.colSpan  = 4;
                            return obj;
                        } else {
                            return record.productName
                        }
                    })
                },
                {
                    title: '描述/规格',
                    dataIndex: 'description',
                    key: 'description',
                    width: 100,
                    render: ((text, record, index) => {
                      const obj = {
                          children: text,
                          props: {},
                      };
                      if(index == this.props.order.orderGoodss.length-1) {
                          obj.props.colSpan  = 0;
                          return obj
                      } else if(index == this.props.order.orderGoodss.length-2) {
                          obj.props.colSpan  = 0;
                          return obj;
                      } else {
                          return record.description
                      }
                    })
                },
                {
                    title: '幅宽',
                    dataIndex: 'larghezza',
                    key: 'larghezza',
                    width: 100,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else {
                            return record.larghezza
                        }
                    })
                },
                {
                    title: '纱支',
                    dataIndex: 'yarn',
                    key: 'yarn',
                    width: 100,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else {
                            return record.yarn
                        }
                    })
                },
                {
                    title: '颜色',
                    dataIndex: 'colour',
                    key: 'colour',
                    width: 100,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else if (index == this.props.order.orderGoodss.length-2) {
                            return this.sumTotal()
                        }else {
                            return record.colour
                        }
                    })
                },

                {
                    title: '单位',
                    dataIndex: 'prickle',
                    key: 'prickle',
                    width: 100,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            obj.children = ''
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {

                        } else {
                            return record.prickle
                        }
                    })
                },
                {
                    title: '数量',
                    dataIndex: 'quantity',
                    key: 'quantity',
                    width: 100,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan  = 0;
                            obj.children = ''
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.colSpan = 0
                            return obj
                        } else {
                            return parseFloat(record.quantity).toFixed(3)
                        }
                    })
                },
                {
                    title: '单价',
                    dataIndex: 'price',
                    key: 'price',
                    width: 100,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan  = 0;
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                          // console.log(this.sumMoney());
                            // obj.props.colSpan = 0
                            obj.children = this.sumMoney()
                            return obj
                        } else {
                            return record.price
                        }
                    })
                },

                {
                    title: '金额',
                    dataIndex: 'tableOrderMoney',
                    key: 'tableOrderMoney',
                    width: 100,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            obj.children = ''
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.colSpan = 0
                            return obj
                        } else {
                            return record.tableOrderMoney
                        }
                    })
                },
                {
                    title: '备注',
                    dataIndex: 'desp',
                    key: 'desp',
                    width: 100,
                    render:((text,record,index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else {
                            return text && text.length > 5 ? (
                                <Tooltip
                                    placement="topLeft"
                                    title={text}
                                    getPopupContainer={() => document.getElementsByClassName("columnsGoodsDetail")[0]}
                                >
                                    <span className='order_detail_remark'>{text}</span>
                                </Tooltip>
                            ) : <span>{text}</span>
                        }
                    })
                }
            ],
            [
                {
                    title: '',
                    dataIndex: '',
                    key: '',
                    width: '60',
                    render: ((text, record, index)=>{
                        if(index == this.props.order.orderGoodss.length-2) {

                        } else if(index == this.props.order.orderGoodss.length-1) {

                        } else {
                            return ++index
                        }

                    })
                },
                {
                    title: '款号',
                    dataIndex: 'styleNo',
                    key: 'styleNo',
                    render: ((text, record, index)=>{
                        if(index == this.props.order.orderGoodss.length-2) {
                            return '合计'
                        } else if(index == this.props.order.orderGoodss.length-1) {
                            return '合计(大写)'
                        } else {
                            return record.styleNo
                        }
                    })
                },
                {
                    title: '品名',
                    dataIndex: 'productName',
                    key: 'productName',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.children = <span style={{display: 'block',textAlign:'left',paddingLeft:'20px'}}>{Util.numtoChinese(this.sumMoney())}</span>
                            obj.props.colSpan  = 9;
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.colSpan  = 5;
                            return obj;
                        } else {
                            return record.productName
                        }
                    })
                },
                {
                    title: '图片',
                    dataIndex: 'url',
                    key: 'url',
                    width: 100,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            return this.sumTotal()
                        } else if(record.url){
                            return (record.url && <img src={record.url} style={{width:140,height:33}} alt="" onClick={this.showImg.bind(this, record.url)}/>)
                        }
                    })
                },
                {
                    title: '描述/规格',
                    dataIndex: 'description',
                    key: 'description',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan  = 0;
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            // obj.props.colSpan  = 0;
                            return obj;
                        } else {
                            return record.description
                        }
                    })
                },
                {
                    title: '颜色',
                    dataIndex: 'colour',
                    key: 'colour',
                    width: 100,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.rowSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            return this.sumMoney()
                        } else {
                            return record.colour
                        }
                    })
                },
                {
                    title: '单位',
                    dataIndex: 'prickle',
                    key: 'prickle',
                    width: 100,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.colSpan = 0
                            return obj
                        } else {
                            return record.prickle
                        }
                    })
                },
                {
                    title: '数量',
                    dataIndex: 'quantity',
                    key: 'quantity',
                    width: 100,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.rowSpan = 0
                            return obj
                        } else {
                            return parseFloat(record.quantity).toFixed(3)
                        }
                    })
                },
                {
                    title: '单价',
                    dataIndex: 'price',
                    key: 'price',
                    width: 100,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.rowSpan = 0
                            return obj
                        } else {
                            return record.price
                        }
                    })
                },
                {
                    title: '金额',
                    dataIndex: 'tableOrderMoney',
                    key: 'tableOrderMoney',
                    width: 100,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.rowSpan = 0
                            return obj
                        } else {
                            return record.tableOrderMoney
                        }
                    })
                },
                {
                    title: '备注',
                    dataIndex: 'desp',
                    key: 'desp',
                    width: 100,
                    render:((text,record,index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {

                        } else {
                            return text && text.length > 5 ? (
                                <Tooltip
                                    placement="topLeft"
                                    title={text}
                                    getPopupContainer={() => document.getElementsByClassName("columnsGoodsDetail")[0]}
                                >
                                    <span className='order_detail_remark'>{text}</span>
                                </Tooltip>
                            ) : <span>{text}</span>
                        }

                    })
                }
            ],
            [
                {
                    title: '',
                    dataIndex: '',
                    key: '',
                    width: '60',
                    render: ((text, record, index)=>{
                        if(index == this.props.order.orderGoodss.length-2) {

                        } else if(index == this.props.order.orderGoodss.length-1) {

                        } else {
                            return ++index
                        }

                    })
                },
                {
                    title: '款号',
                    dataIndex: 'styleNo',
                    key: 'styleNo',
                    render: ((text, record, index)=>{
                        if(index == this.props.order.orderGoodss.length-2) {
                            return '合计'
                        } else if(index == this.props.order.orderGoodss.length-1) {
                            return '合计(大写)'
                        } else {
                            return record.styleNo
                        }
                    })
                },
                {
                    title: '品名',
                    dataIndex: 'productName',
                    key: 'productName',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.children = <span style={{display: 'block',textAlign:'left',paddingLeft:'20px'}}>{Util.numtoChinese(this.sumMoney())}</span>
                            obj.props.colSpan  = 11;
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.colSpan  = 7;
                            return obj;
                        } else {
                            return record.productName
                        }
                    })
                },
                {
                    title: '描述/规格',
                    dataIndex: 'description',
                    key: 'description',
                    width: 200,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan  = 0;
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.colSpan  = 0;
                            return obj;
                        } else {
                            return record.description
                        }
                    })
                },
                {
                    title: '纱线类型',
                    dataIndex: 'yarnTypes',
                    key: 'yarnTypes',
                    width: 100,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan  = 0;
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.colSpan = 0
                            return obj
                        } else {
                            return record.yarnTypes
                        }
                    })
                },
                {
                    title: '成纱状态',
                    dataIndex: 'yarnState',
                    key: 'yarnState',
                    width: 100,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan  = 0;
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            return this.sumTotal();
                        } else {
                            return record.yarnState
                        }
                    })
                },
                {
                    title: '成分',
                    dataIndex: 'constituent',
                    key: 'constituent',
                    width: 100,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan  = 0;
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {

                        } else {
                            return record.constituent
                        }
                    })
                },
                {
                    title: '纱支',
                    dataIndex: 'yarn',
                    key: 'yarn',
                    width: 100,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan  = 0;
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            return this.sumMoney();
                        } else {
                            return record.yarn
                        }
                    })
                },
                {
                    title: '单位',
                    dataIndex: 'prickle',
                    key: 'prickle',
                    width: 100,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.colSpan  = 0;
                            return obj
                        } else {
                            return record.prickle
                        }
                    })
                },
                {
                    title: '数量',
                    dataIndex: 'quantity',
                    key: 'quantity',
                    width: 100,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.colSpan  = 0;
                            return obj
                        }  else {
                            return parseFloat(record.quantity).toFixed(3)
                        }
                    })
                },
                {
                    title: '单价',
                    dataIndex: 'price',
                    key: 'price',
                    width: 100,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan = 0
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.colSpan  = 0;
                            return obj
                        } else {
                            return record.price
                        }
                    })
                },
                {
                    title: '金额',
                    dataIndex: 'tableOrderMoney',
                    key: 'tableOrderMoney',
                    width: 100,
                    render: ((text, record, index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan  = 0;
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {
                            obj.props.colSpan = 0
                            return obj
                        } else {
                            return record.tableOrderMoney
                        }
                    })
                },
                {
                    title: '备注',
                    dataIndex: 'desp',
                    key: 'desp',
                    width: 100,
                    render:((text,record,index)=>{
                        const obj = {
                            children: text,
                            props: {},
                        };
                        if(index == this.props.order.orderGoodss.length-1) {
                            obj.props.colSpan  = 0;
                            return obj
                        } else if(index == this.props.order.orderGoodss.length-2) {

                        } else {
                            return text && text.length > 5 ? (
                                <Tooltip
                                    placement="topLeft"
                                    title={text}
                                    getPopupContainer={() => document.getElementsByClassName("columnsGoodsDetail")[0]}
                                >
                                    <span className='order_detail_remark'>{text}</span>
                                </Tooltip>
                            ) : <span>{text}</span>
                        }
                    })
                }
            ]
        ]
        return (
            <div>
              {
                  <p className="main_order_detail_box_info_orderId">订单编号：{this.props.order.oid} &nbsp;&nbsp;
                      {
                          this.props.order.orderType == 1 ? (
                              <span>&nbsp;&nbsp;订单类型：{this.props.order.makeType == null ? '无': this.props.order.makeType}</span>
                          ): null
                      }
                      {
                        this.props.order.orderType == 1 && this.props.order.partA == this.enterpriseId ? (
                            <span>&nbsp;&nbsp;客户号：{this.props.order.traderName == '' ? '无': this.props.order.traderName}</span>
                        ): null
                      }
                      <span>币种：人民币</span>
                  </p>
              }
                <Table
                    dataSource={this.props.order.orderGoodss}
                    columns={columnsArr[this.orderType-1]}
                    className="order_table order_detail_table columnsGoodsDetail main_order_detail_box_th1"
                    // bordered
                    rowKey={record => record.gid}
                    scroll={{ x: 1150 }}
                    pagination={false}
                />
              <AddImgModal ref="addimg" disn={'true'}/>
            </div>
        )
    }
}
